package buxfer;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import java.util.concurrent.TimeUnit;

/**
 * Created with IntelliJ IDEA.
 * User: stem
 * Date: 15.11.13
 * Time: 9:25
 * To change this template use File | Settings | File Templates.
 */
public class Reg {
    private String logname="stem4444@mail.ru";
    private String logpass="stem4444";
    private WebDriver driver;
    @FindBy(id="signupEmail")
    private WebElement name;
    @FindBy(id="signup_password")
    private WebElement pass;
    @FindBy(xpath ="//*[@id='signup_table']//input[@type='submit']")
    private WebElement regBtn;
    @FindBy(xpath ="//*[@id='signup_table']//div[@class=' button']//a")
    private WebElement regBtn1;
    public Reg(WebDriver driver){
        this.driver=driver;
        PageFactory.initElements(driver, this);
    }
    public assertPage regConfirm(){
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        name.click();
        name.clear();
        name.sendKeys(logname);
        pass.click();
        pass.clear();
        pass.sendKeys(logpass);
        regBtn.getLocation().move(regBtn.getLocation().getX(),regBtn.getLocation().getY());
        Actions build= new Actions(driver);
        build.moveToElement(regBtn).click();
        driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
        regBtn1.click();
        return new assertPage(driver);

    }
}
